import init from './config';
import http from './http';


//轮播图和启动图接口
const banner = (params) => {
  return http(init.methods.GET, init.url.banner, params)
}

//分类九宫格接口
const category = (params) => {
  return http(init.methods.GET, init.url.category, params)
}
//商品列表接口
const goodsList = (params) => {
  return http(init.methods.POST, init.url.goodsList, params)
}
//商品详情接口
const goodsDetails = (params) => {
  return http(init.methods.GET, init.url.goodsDetails, params)
}
//添加购物车接口
const addCart = (params) => {
  return http(init.methods.POST, init.url.addCart, params)
}
//查看购物车接口
const getCartInfo = (params) => {
  return http(init.methods.GET, init.url.getCartInfo, params)
}
//删除购物车某条数据
const removeCartInfo = (params) => {
  return http(init.methods.POST, init.url.removeCartInfo, params)
}
//修改商品数量
const modifyNumber = (params) => {
  return http(init.methods.POST, init.url.modifyNumber, params)
}
//添加商品收藏
const favAdd = (params) => {
  return http(init.methods.POST, init.url.favAdd, params)
}
//删除商品收藏
const favDelete = (params) => {
  return http(init.methods.POST, init.url.favDelete, params)
}
//查看商品是否已收藏
const favCheck = (params) => {
  return http(init.methods.GET, init.url.favCheck, params)
}
//无限生成小程序码
const unLimit = (params) => {
  return http(init.methods.POST, init.url.unLimit, params)
}
//获取收藏列表
const favList = (params) => {
  return http(init.methods.POST, init.url.favList, params)
}
//退出登录接口
const loginout = (params) => {
  return http(init.methods.GET, init.url.loginout, params)
}
//添加收货地址接口
const addAddress = (params) => {
  return http(init.methods.POST, init.url.addAddress, params)
}
//删除收货地址接口
const deleteAddress = (params) => {
  return http(init.methods.POST, init.url.deleteAddress, params)
}
//修改收货地址接口
const updateAddress = (params) => {
  return http(init.methods.POST, init.url.updateAddress, params)
}
//获取收货地址列表
const addressList = (params) => {
  return http(init.methods.GET, init.url.addressList, params)
}
//获取收货地址详情
const addressDetail = (params) => {
  return http(init.methods.GET, init.url.addressDetail, params)
}
//获取默认收获地址
const addressDefault = (params) => {
  return http(init.methods.GET, init.url.addressDefault, params)
}
//获取省列表
const province = (params) => {
  return http(init.methods.GET, init.url.province, params)
}
//获取市或区列表
const city = (params) => {
  return http(init.methods.GET, init.url.city, params)
}




export const bus = {
  banner,
  category,
  goodsList,
  goodsDetails,
  addCart,
  getCartInfo,
  removeCartInfo,
  modifyNumber,
  favAdd,
  favDelete,
  favCheck,
  unLimit,
  favList,
  loginout,
  addAddress,
  deleteAddress,
  updateAddress,
  addressList,
  addressDetail,
  addressDefault,
  province,
  city
}